
// ex.client.RootPresenter.java
package com.mercator.client.main.presenter;

import java.util.Collection;
import java.util.Set;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Widget;
import com.mercator.client.AppEventBus;
import com.mercator.client.graph.GenType;
import com.mercator.client.graph.GeneSet;
import com.mercator.client.graph.MapName;
import com.mercator.client.main.view.RootView;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;

@Presenter( view = RootView.class )
public class RootPresenter extends BasePresenter<RootView, AppEventBus> {

	public void bind() {
		
		for(MapName name :MapName.values())
			view.getMapSelection().addItem(name.getName());
			
		
		view.getDrawBtn().addClickHandler(new ClickHandler(){
			@Override
			public void onClick(ClickEvent event) {
	
				eventBus.goToMap(MapName.getMap(view.getSelectedMap()));
				
				
			}
		});
		
		view.setImage("jaccard.png");
		view.setGeneSetPage("http://ontologicaldiscovery.org/index.php?action=manage&cmd=viewgeneset&gs_id=34560");
		
	}

	public void onTextChange(String newText) {  // this method recieves the eventbus textChange event
		//view.label.setText(newText);
	}

	public void onChangeBody(Widget w){
		view.setBody(w);
	}
	
	public void onChangeMap(Set<? extends GenType> dc){
		view.setGeneSetList(dc);
	}

}








